UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I47D1M+mNqK6u70YjAEPGrm1AVZA8EqSQzjwcRCsjUE=' 
WHERE 
  key_id = 'd0c304a8552d79656d99ddb6cee7f948ff916283bc1eea84a2e39c58db540a3a' 
  AND (
    token = 'I47D1M+mNqK6u70YjAEPGrm1AVZA8EqSQzjwcRCsjUE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040