UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HjD9nWqeu4s/eMPKZhggmVBjVx01aRTYtaCnajVh0+o=' 
WHERE 
  key_id = 'bfa82a1f9fe514c2df014c07de5aec3c4fa20ac073a58e8d965136e4da9cdef2' 
  AND (
    token = 'HjD9nWqeu4s/eMPKZhggmVBjVx01aRTYtaCnajVh0+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026