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

Query time 0.00041