UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/durexV790uQAK/GQUubPb+N2TcCvJfBDjDT0yWjY+c=' 
WHERE 
  key_id = '36440128bd49b721d1be5346f79c6242a938b431e753e6abcca13d95e922d7a3' 
  AND (
    token = '/durexV790uQAK/GQUubPb+N2TcCvJfBDjDT0yWjY+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050