UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7kdh2G1HvswrspRD+zyviw++He+OD0BxN0yCRCdQ4j4=' 
WHERE 
  key_id = 'e545a5f24506eb53cb44249e2666ef995735341407fea1c4e5dcee358d0a702b' 
  AND (
    token = '7kdh2G1HvswrspRD+zyviw++He+OD0BxN0yCRCdQ4j4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027