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

Query time 0.00021