UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ug6ZcgLfURoUBpz/8fgPDTvPQB1WTXp7AbsTd7tafGY=' 
WHERE 
  key_id = '5c00db72725b5d89b48b7fe4cc660345859bb70b9b6884b56fe627de38032f53' 
  AND (
    token = 'Ug6ZcgLfURoUBpz/8fgPDTvPQB1WTXp7AbsTd7tafGY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047