UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1Ewb4VtfsAAnXey6KJCU9fgJ9uypOdc5s0fZ78pCchU=' 
WHERE 
  key_id = '9f358e054eac629b59ca8b1ddc5fe0345c2f0cd78c4be8aaf535adf1ccf58195' 
  AND (
    token = '1Ewb4VtfsAAnXey6KJCU9fgJ9uypOdc5s0fZ78pCchU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016