UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YRGLP3JM87AO8BDtULxcjx355w9r9Xo91gRykJYaFFo=' 
WHERE 
  key_id = '7fb54c1684a1ad9cf516cda8bd73f2f800cf855e65264b6f5b86f86706485167' 
  AND (
    token = 'YRGLP3JM87AO8BDtULxcjx355w9r9Xo91gRykJYaFFo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036