UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2TdmXk1xO3Xf0FFgWS6piqSTjwM75u4K94YYCrivIJA=' 
WHERE 
  key_id = '05e32d5858edb035e410f736f1edb14c79d4c09d34230c9609418f36b76f2e49' 
  AND (
    token = '2TdmXk1xO3Xf0FFgWS6piqSTjwM75u4K94YYCrivIJA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039