UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H8fDPBSbVmBpOFqUpXbSoDZUMiK2xWVzG2EpOhFWxlc=' 
WHERE 
  key_id = '0cec660d17c471970157f6d6a414bb08deef1262b69cd76a7c2db7894a41b154' 
  AND (
    token = 'H8fDPBSbVmBpOFqUpXbSoDZUMiK2xWVzG2EpOhFWxlc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042