UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4pE5T7VNsLh+y163/lkb2RL0MOSA5S8fycSe6P8i+WY=' 
WHERE 
  key_id = '0ad657ed7463df97e9339f72c9b8adfb0aa3bae80527b71901ea9f12b8c88bb6' 
  AND (
    token = '4pE5T7VNsLh+y163/lkb2RL0MOSA5S8fycSe6P8i+WY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047