UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jX03UE9JDDJ+gjUOu3c+jjCHr47JK2JUCtZ/4Vtcy0s=' 
WHERE 
  key_id = '569dacb4dd86b58194cc04eb6738ceb962de1b4ab36ceaeb974250cb8aba6601' 
  AND (
    token = 'jX03UE9JDDJ+gjUOu3c+jjCHr47JK2JUCtZ/4Vtcy0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032