UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MZQWCtZVv0iUiQoF2b4KMWd/nwdhsqOd09LJfoIqYbI=' 
WHERE 
  key_id = '9313961eae90382718266509154844fb247529d567aabcb8e1c24d682971ae84' 
  AND (
    token = 'MZQWCtZVv0iUiQoF2b4KMWd/nwdhsqOd09LJfoIqYbI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052