UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '46V4aC85fHNUgdfei6eDEfhjFW0VY+N8iLyFJwIxMuc=' 
WHERE 
  key_id = '9aa715d343c258c3f773bd04dc4316bc31f44cc6b1b2db38eed1a4376b3012e8' 
  AND (
    token = '46V4aC85fHNUgdfei6eDEfhjFW0VY+N8iLyFJwIxMuc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053