UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L2jVd7A+a7k/eS+PsrPgIeXZaS8UVpcnXrakey5YaNo=' 
WHERE 
  key_id = '5947b5b333dba53430755a930bb01355b50e1db544e326e5c61e2b1003e776a8' 
  AND (
    token = 'L2jVd7A+a7k/eS+PsrPgIeXZaS8UVpcnXrakey5YaNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065