UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UiAZNC4aKI5qRSbPctCiWLRNc3xvxMstC3qG+x3z8eQ=' 
WHERE 
  key_id = '738c9345dd8cbcf5b276a1c37d673b7c935d87dab6c9931a784d0dfec91e97d7' 
  AND (
    token = 'UiAZNC4aKI5qRSbPctCiWLRNc3xvxMstC3qG+x3z8eQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034