UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FEe4glNDPv28q4MKrJfYY35O8KoW51InA9mshqn4WbE=' 
WHERE 
  key_id = '2a1357faa354197f5a2ef7b9668c71e9927c4493bd7725018396a82227154ec0' 
  AND (
    token = 'FEe4glNDPv28q4MKrJfYY35O8KoW51InA9mshqn4WbE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040