UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TZ4b6s4n9CekPDLtY41+aTzQtdKmMUxYaUp4B7fmVS8=' 
WHERE 
  key_id = 'edc976bf5a0e5d066bb9a00feeca9fa15001d6aa92717a4c701c1410d124c4c0' 
  AND (
    token = 'TZ4b6s4n9CekPDLtY41+aTzQtdKmMUxYaUp4B7fmVS8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025