UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RCNkB6Cc/wu9+tHo1jzxch+BTepd0VoFHZIoILtuXak=' 
WHERE 
  key_id = 'a44b236cdbc13c92b49bd12ffdb3e1e60156e45cc74adacb920215825f45f4dd' 
  AND (
    token = 'RCNkB6Cc/wu9+tHo1jzxch+BTepd0VoFHZIoILtuXak=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050