UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EpfWi0qxLG/kYhU5vW+kQcAorJWGr8NmFYJThYVNPXk=' 
WHERE 
  key_id = '56c75246d311298adaee7fb00a90236e680d4ec9615c7243c73befd91fa95e3b' 
  AND (
    token = 'EpfWi0qxLG/kYhU5vW+kQcAorJWGr8NmFYJThYVNPXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017