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

Query time 0.00029