UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IpgY9mFlS+NT9f+TeoMkLN8LgVUbRAeCOT0A9wBpCZ0=' 
WHERE 
  key_id = '56df5678c2de8c7ca763b2804549d95180c86498f00e7a480eb6c829b7cea393' 
  AND (
    token = 'IpgY9mFlS+NT9f+TeoMkLN8LgVUbRAeCOT0A9wBpCZ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038