UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OnrKr47c/uVxeqQDKS5pnioXV8N+1wn7d77TDRZRiFM=' 
WHERE 
  key_id = '810f7befb57693d6d469de127d335405c42e9cfacddf41e22ab61682b32c6322' 
  AND (
    token = 'OnrKr47c/uVxeqQDKS5pnioXV8N+1wn7d77TDRZRiFM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065