UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qUChFTpR6sTlwe0qvDLewA2HhS+s+uRkO/D57k5jEmI=' 
WHERE 
  key_id = '5b6b120a6a8d12508149e340bb61a95ec52513b68408ade98894c51540a7956d' 
  AND (
    token = 'qUChFTpR6sTlwe0qvDLewA2HhS+s+uRkO/D57k5jEmI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036