UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vVuXDT6+WHW66nPvpOCHzwpEKhMON/JJfMw5G3pmSNA=' 
WHERE 
  key_id = '794760957a2bdd1d6a8a181d5de79fd76d67fa7b272433485e29951e144f5f77' 
  AND (
    token = 'vVuXDT6+WHW66nPvpOCHzwpEKhMON/JJfMw5G3pmSNA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048