UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CsOG2mkpwinJStAj5rgRL+0V6VFUZLs+R/vKzdTQIT4=' 
WHERE 
  key_id = '5209492269e80067e33027b207f3c630107181197e6f256cf74c025874e633b6' 
  AND (
    token = 'CsOG2mkpwinJStAj5rgRL+0V6VFUZLs+R/vKzdTQIT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037