UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AcDut6VJNklhBQ4Vhf8Z7pgUtv9BPv1rAxNZmuWhr+w=' 
WHERE 
  key_id = 'bce3ed67c7fa08a5a52275aa7cd7248f0768743ce99baab9536ec01bb21a6365' 
  AND (
    token = 'AcDut6VJNklhBQ4Vhf8Z7pgUtv9BPv1rAxNZmuWhr+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00116