UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KU+bAdL0Bzssl0s9TWWhy1MjeIMsF9HIgbn6xe2/xbk=' 
WHERE 
  key_id = '9297e7d84c82dfcaf41cd49e265008f8f9e9d7096064f72fc9000911848da866' 
  AND (
    token = 'KU+bAdL0Bzssl0s9TWWhy1MjeIMsF9HIgbn6xe2/xbk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029