UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dzibAV1NqdMK8G1DulkUpkIVgwP6PdPuR3hhaVsLgQ8=' 
WHERE 
  key_id = '2dfc461552d59685095c222ded5257c04ccdb321ffec102119c8715c31560d5f' 
  AND (
    token = 'dzibAV1NqdMK8G1DulkUpkIVgwP6PdPuR3hhaVsLgQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037