UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UKbZwmzsWzVkIXbzKW761lZi3t80Hgpk0fwu23flzbg=' 
WHERE 
  key_id = 'b042cdd813a8f6d7f43c53cfdb26e7a96c4ed87ecc2ab24c66a75f0cb9363583' 
  AND (
    token = 'UKbZwmzsWzVkIXbzKW761lZi3t80Hgpk0fwu23flzbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024