UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A27BNY0ZmR6VNsZnMbQOBec1xaM3GYSLKm6iSf7Dnek=' 
WHERE 
  key_id = '8703fbc25f5a0ae9f86d405ba6a50b2245c36d12b7e5a942dc6029d2267c85a9' 
  AND (
    token = 'A27BNY0ZmR6VNsZnMbQOBec1xaM3GYSLKm6iSf7Dnek=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040